package sss;

import java.util.Scanner;

/**
 * @author VernHe
 * @date 2021年08月15日 17:17
 */
public class Day_06_1 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        solution(n);
    }
    
    private static void solution(int n) {
        int result = 0;
        for (int i = 1; i <= n; i++) {
            char[] chars = String.valueOf(i).toCharArray();
            int l = 0,r = chars.length - 1;
            while (l < r) {
                if (chars[l] == chars[r]) {
                    ++l;
                    --r;
                } else {
                    break;
                }
            }
            if (l >= r) {
                ++result;
            }
        }
        System.out.println(result);
    }
}
